<%@Page Language="VB"%>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.SqlClient" %>
<html><head>
<title>
DatGrid Control </title>
</head>
<body>
<span class="heading">DataGrid Control Simple</span>
<hr width="350" align="left"/>
<div id="outError" runat="server">&nbsp;</div>
<asp:datagrid id="dgrResult"	 runat="server" /> 
<script language="vb" runat="server">
Sub Page_Load(ByVal sender As Object, _
ByVal e As EventArgs)      
   Dim myDataSet As New DataSet 
   Try
      Dim strConn As String
      Dim strSQL As String
      strConn= _
      ConfigurationSettings.appSettings("conn")
      Dim myConn As New SqlConnection(strConn)      
      strSQL = "SELECT UserID,UserName,"
      strSQL +=" FullName,Email From tblUsers"
      Dim myDataAdapter As New _
	SqlDataAdapter(strSQL, myConn)
      myDataAdapter.Fill(myDataSet, strSQL)     
   Catch objError As Exception
      	outError.innerHTML = _
	"<b>* Error while " & _
	"accessing data</b>.<br />" _
          	& objError.Message & "<br />" & _
	objError.Source
      Exit Sub  
   End Try   
   dgrResult.AutoGenerateColumns=True
   dgrResult.DataSource = myDataSet
   dgrResult.DataBind()   
End Sub
</script>
</body>
</html>
  